home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1987 July / Ahoy_Magazine_87-07_1987_Double_L_Side_A.d64 / Exp. Power (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  472b  |  17 lines

  1. 0 rem << cd43-1 >>
  2. 1 rem ==================================
  3. 2 rem    commodares problem #39-1 :
  4. 3 print"[147]   [197]xponential [208]ower"
  5. 4 rem    solution by
  6. 5 rem    scott duncan, lon olson, and
  7. 6 rem    ellis hormats
  8. 7 rem ==================================
  9. 10 print"evaluate n terms of series approximation for exp(x)"
  10. 20 input "input x,n";x,n
  11. 30 t=1 : e=1
  12. 40 for z=1 to n
  13. 50 t=t/z*x : e=e+t
  14. 60 next z
  15. 70 print "e ^";x;"is approximately "e
  16. 80 print " with an accuracy of" 100*(1-t*x/z);"%"
  17.